package yunquan.wang.core.service;

import java.util.Collection;
import java.util.List;

import org.springframework.context.ApplicationEventPublisherAware;
import org.springframework.data.domain.Page;
import org.springframework.data.domain.Pageable;

import yunquan.wang.core.dao.PropertyFilter;
import yunquan.wang.core.dao.springdata.BaseRepository;

public interface BaseService<T> extends ApplicationEventPublisherAware{

	public BaseRepository<T,String> getDao();

	/**
	 * 保存对象
	 * 
	 * @param entity
	 * @return
	 */
	public T save(T entity);

	/**
	 * 查询单个对象
	 * 
	 * @param id
	 * @return
	 */
	public T get(String id);
	
	/**
	 * 根据ID删除
	 * @param id
	 */
	public void delete(String id);

	/**
	 * 获取全部对象
	 * 
	 * @return
	 */
	public List<T> findAll();

	/**
	 * 根据Filter查询对象
	 * 
	 * @param filters
	 * @return
	 */
	public List<T> findList(Collection<PropertyFilter> filters);
	/**
	 * 分页查询对象
	 * @param filters
	 * @param page
	 * @return
	 */

	public Page<T>  findPage(Pageable page,Collection<PropertyFilter> filters);
	/**
	 * 
	 * @param page
	 * @param filters
	 * @param fetchProperties
	 * @return
	 */
	public Page<T> findPage(Pageable page, Collection<PropertyFilter> filters,
			String... fetchProperties);

 
}